/**
 * @project Textoo
 * @author Bertrand Larrieu - lab9
 * @mail lab9.fr@gmail.com
 * @timestamp 18/10/2011 08:05
 * @version 0.1
 */

package  
{
	import flash.display.Sprite;
	import org.looty.textoo.context.TextooContext;
	import org.looty.textoo.events.TextooEvent;
	import org.looty.textoo.Textoo;

	public class HelloWorld extends Sprite
	{
		/** 
		* Embed Font
		*/
		[Embed(source="Vera.ttf", mimeType="application/x-font-truetype", fontName="Bitstream Vera Sans", fontStyle="normal", fontWeight="normal", unicodeRange="U+0020-U+007E,U+00A1-U+00FF,U+0152-U+0153", embedAsCFF='false')]
		static public const VERA:Class;
		
		private var _textoo		:Textoo;
		private var _context	:TextooContext;
		
		public function HelloWorld() 
		{
			_context = new TextooContext();
			_context.addStyleSheet(".hw{font-family:Bitstream Vera Sans;font-size: 20;color:#beb8ad;text-align:left;}");
			_context.addLocalText("hello", "", "Hello World", "hw");
			
			//_context.dump();
			
			Textoo.defineGlobalContext(_context);
			
			_textoo = new Textoo(0, 0, "hello");
			_textoo.addEventListener(TextooEvent.UPDATE, update);
			addChild(_textoo);	
		}
		
		private function update(e:TextooEvent):void 
		{
			_textoo.x = (stage.stageWidth - _textoo.width) >> 1;
			_textoo.y = (stage.stageHeight - _textoo.height) >> 1;
		}
		
	}

}